package main

import (
	"flag"
	"fmt"

	_ "gitee.com/freebird92/wallet-service/mycontract"

	"gitee.com/freebird92/wallet-service/api"
	"gitee.com/freebird92/wallet-service/setting"
)

var fileSetting = flag.String("setting", "conf/settings.json", "file path name of settings")

func main() {
	Init()
}

func Init() error {
	err := settings.Init(*fileSetting)
	if err != nil {
		fmt.Println("fail to read config file ", *fileSetting, err.Error())
		return err
	}
	fmt.Println(settings.GetDsn())
	err = Service.Init(settings.GetRpc(), settings.GetDsn(), settings.GetPort())
	if err != nil {
		fmt.Println("fail to init service, ", err.Error())
		return err
	}
	return nil
}
